package com.jz.community.moduleshoppingguide.nearshop.presenter;

import com.jz.community.basecomm.mvp.BaseLifeCyclePresent;
import com.jz.community.basecomm.net.rxandroid.OnLoadListener;
import com.jz.community.moduleshoppingguide.home.model.ShoppingGuideModel;
import com.jz.community.moduleshoppingguide.home.model.ShoppingModelGuideImpl;
import com.jz.community.moduleshoppingguide.nearshop.bean.GoodsInfo;
import com.jz.community.moduleshoppingguide.nearshop.ui.NearShopGoodsDetailView;

public class NearShopGoodsDetailPresenter extends BaseLifeCyclePresent<NearShopGoodsDetailView.View> implements NearShopGoodsDetailView.Presenter {


    private ShoppingGuideModel shoppingModel;
    private NearShopGoodsDetailView.View mView;

    public NearShopGoodsDetailPresenter(NearShopGoodsDetailView.View mView) {
        this.mView = mView;
        this.shoppingModel = new ShoppingModelGuideImpl(mView.getContext());
    }

    @Override
    public void getGoodsInfoes(String filter, int page, int size) {
        shoppingModel.showCategorysGoodsInfoes(filter, page, size, new OnLoadListener<GoodsInfo>() {
            @Override
            public void onSuccess(GoodsInfo baseGoodsInfo) {
                mView.showGoodsInfoes(baseGoodsInfo);
            }

            @Override
            public void onFail(String s,int code) {
                mView.onFail(s);
            }
        });
    }
}
